/**
 * Created by machan on 2017/3/24.
 */


//打开调试模式，生产需要关闭
const DEBUG = true;
//设置环境 ,生产需要设置为 3
// 0:develep 1:test 2:uat 3 release
let _ENV = "0";

//开发地址
 //const DEV_URL = "http://10.10.56.145:8180/umfWeChatPlat";
const DEV_URL = "http://10.10.133.155:8080/umfWeChatPlat";
//测试地址
const TEST_URL = "http://10.10.178.107:8080/umfWeChatPlat";
//UAT地址
const UAT_URL = "https://xydev.umfintech.com/umfWeChatPlat/";
//发布地址
const RELEASE_URL = "https://xy.umfintech.com/umfWeChatPlat/";

const Env = {DEV: "0", TEST: "1", UAT: "2", RELEASE: "3"};
function url() {
    if (_ENV=== Env.DEV) {
        return DEV_URL;
    } else if (_ENV === Env.TEST) {
        return TEST_URL;
    } else if (_ENV === Env.UAT) {
        return UAT_URL;
    } else if (_ENV === Env.RELEASE) {
        return RELEASE_URL;
    } else {
        //custom
        let customUrl = wx.getStorageSync("customUrl");
        return customUrl?  customUrl: "http://10.10./umfWeChatPlat";
    }
}

function setEnv(env) {
    _ENV = env;
}

function getEnv() {
    return _ENV;
}

module.exports = {
    //挡板开关
    dangban: false,
    DANGBAN_URL: "http://m_dev.soopay.net/moco",
    // DANGBAN_URL: "http://10.10.77.91:12306",
    //是否为调试模式
    debug: DEBUG,
    //发布审核时使用的账号，跳过必要参数,待下个版本删除 TODO
    isWeAudit: true,
    weAuditUser: {assistId: 'SAAS', userId: 'admin'},
    //环境
    _setEvn: setEnv,
    getEnv: getEnv,
    //环境常量
    ENV: Env,
    //url地址
    url: url,
    //定位ak
    LOCATION_AK: "hUCV6vZFd556FBep9UqTSiB1fSqjFbtq",
    //费率最小值最大值
    RATE_MIN: "0",
    RATE_MAX: "10",
    AGENT_TYPE: "1",
    INITIIAL_PWD: "111111",
    //---------------------Interfaces---------------
    Interfaces: {
        //------------------登录模块--------------------
        //登录
        FUNC_LOGIN: '/login/loginOn',
        //自动登录
        FUNC_AUTO_LOGIN: '/autoLogin/loginOn',
        //------------------自动部署--------------------
        //自助部署列表接口
        FUNC_MERCHANT_LIST: '/merchantDeploy/merchantList',
        //部署详情接口
        FUNC_MERCHANT_DETAIL: '/merchantDeploy/merchantDetail',
        //修改店铺详情接口
        FUNC_MERCHANT_MODIFY: '/merchantDeploy/merchantModify',
        //提交收款人信息接口
        FUNC_PAYEEINF: '/merchantDeploy/payeeInf',
        //提交店铺信息接口
        FUNC_UPDATE_STOREINF: '/merchantDeploy/updateStoreInf',
        //照片信息上传接口
        FUNC_UPLOAD_IMG: '/merchantDeploy/uploadImg',
        //照片信息提交接口
        FUNC_SUBMIT_IMG: '/merchantDeploy/submitImg',
        //开通立马付产品接口
        FUNC_OPEN_IMPAY: '/merchantDeploy/openImPay',
        //展示立马付产品接口
        FUNC_IMPAY_DISPLAY: '/merchantDeploy/imPayDisplay',
        //展示二维码接口
        FUNC_QRCODE_DISPLAY: '/merchantDeploy/qrCodeDisplay',
        //开通pos信息提交接口
        FUNC_OPENPOS_SUBMIT: '/newMerchantProductDeploy/openPosSubmit',
        //开通pos上传照片接口
        FUNC_OPENPOS_UPLOAD: '/newMerchantProductDeploy/uploadImg',
        //银行名称列表查询接口
        FUNC_QUERY_BANKLIST: '/merchantProductDeploy/queryBankNameList',
        //Pos回调接口
        FUNC_POS_CB: '/merchantProductDeploy/posCallbackMethod',
        //------------------我的商户--------------------
        //商家交易概括图
        FUNC_Merchant_JYGKT: '/mystores/queryMerTradeAmountBystores',
        //商家昨日交易列表
        FUNC_Merchant_YesterdayTrading: '/mystores/queryYesterdayMerTradeAmountBystores',
        //商户交易页面
        FUNC_Merchant_MonthTrading: '/mystore/queryCurstoreTrade',
        //店铺搜索
        FUNC_Merchant_Query: '/mystore/querystoreByName',
        //店铺信息
        FUNC_Merchant_STOREINFO: '/mystore/querystoreDetail',
        //商家日交易列表
        FUNC_Merchant_DayTrading: '/mystore/queryCurDateTradeDetail',
        //订单查询
        FUNC_Merchant_QueryOrder: '/tradeDetail/queryOrderDetail',
        //店铺绑定收款吗
        FUNC_Merchant_BINDQRCODE: '/mystore/bindQrCode',
        //月账单
        FUNC_Merchant_MonthAccount: '/mystores/queryCurstoreTradeByMonth',
        //对账
        FUNC_Merchant_BILLEMAIL: '/mystores/sendBillEmail',
        //------------------代理商----------------------
        //添加业务员
        FUNC_SALESMAN_ADD: '/agentManagement/salesmanAdd',
        //业务员列表_生成二维码
        FUNC_QR_SALESMAN: '/agentManagement/getwxacode',
        //删除业务员
        FUNC_DELETE_SALEMAN: '/agentManagement/salesmanStateModifiy',
        //个人信息维护
        FUNC_MESS_MODIFIY: '/agentManagement/salesmanMessModifiy',
        //分润查询列表
        FUNC_QUERY_ALL_PROFIT: '/profit/queryAllProfit/',

        //POS分润汇总查询
        FUNC_S_POS_OR: '/profit/queryProfit/queryProfitPosList',
        //POS分润明细查询
        FUNC_S_POS_DT: '/profit/queryProfit/queryProfitPosDetail',
        //非POS分润汇总查询
        FUNC_SN_POS_OR: '/profit/queryProfit/queryProfit',
        //非POS分润明细查询
        FUNC_SN_POS_DT: '/profit/queryProfit/getDetailProfit',

        //意见反馈
        FUNC_FEEDBACK_ADD: '/feedback/feedBackAdd',
        //我的业务员列表
        FUNC_SALESMAN_LIST: '/agentManagement/salesmanList',
        //业务员列表详情
        FUNC_QUERY_SCOREDETAIL: '/agentManagement/queryScoreDetaild',
        //配置费率添加、修改
        FUNC_SAVE_RATES: '/Rates/saveRates',
        //配置费率的查询
        FUNC_QUERY_RATES: '/Rates/queryRates',

        //三期
        //登录修改密码
        FUNC_UPDATE_LOGIN_PWD: "/agentManagement/updateLoginPwd",
        //查询业务员权限
        FUNC_QUERY_PERM_CONF: "/agentManagement/querySalesmanLimitConfig",
        //修改业务员权限
        FUNC_SALEMAN_LIMIT_CONF: "/agentManagement/updateSalesmanLimitConfig",
        //重置业务员登录密码
        FUNC_RESET_PWD: "/agentManagement/resetSalesmanPwd",
        //代理商查询商户
        FUNC_SEARCH_STORES: "/agentSeacherStroe/queryStoreByCondition",
        //代理商开户
        FUNC_OPEN_AGENT: "/agentManagement/openAgent",
        //修改代理商信息
        FUNC_MODIFY_AGENTINFO: "/agentManagement/updateAgent",
        //重置代理商密码
        FUNC_RESET_AGENTPWD: "/agentManagement/resetAgentPwd",

        //查询代理商
        FUNC_SEARCH_AGENT: "/agentManagement/queryAgentByName",
        //查询代理商详情
        FUNC_SEARCH_AGENT_DETAILS: "/agentManagement/getAgentByPrimaryKey",
        //开通下级代理商获取代理商编号
        FUNC_GET_AGENTID: "/agentManagement/getAgentId",
        //代理商获取对账邮件
        FUNC_AGENT_SEND_BILLEMAIL: "/agentBill/sendAgentBillEmail",
        //获取非pos分润邮件
        FUNC_PROFIT_SENDBILLEMAIL: '/agentProfit/sendBillEmail',
        //停用启用业务员
        FUNC_CHANGE_SALEMAN_STATUS: "/agentManagement/salesmanDown",

        //四期
        //删除商户
        FUNC_DELETE_STOREINFO: "/merchantDeploy/delStorInfo",
        //获取装机区域
        FUNC_GETINSTALLAREA:"/newMerchantProductDeploy/getArea",
        //获取序列号
        FUNC_GETSERIALS:"/newMerchantProductDeploy/getSn",
        //每日交易列表、立马付总计统计
        FUNC_IMP_TOTALAMT:"/mystore/getWxTotalAmt",
        //每日交易列表、pos总计统计
        FUNC_POS_TOTALAMT: "/mystore/getPosTotalAmt",
        //POS每日交易列表
        FUNC_POS_TRADINLIST:"/mystore/getPosDayPayOrderList",
        //POS交易详情
        FUNC_POS_TRADDETAIL:"/mystore/getPosPayOrder",
        //POS查看接口
        FUNC_POS_QUERYINFO: "/PosBaseController/queryPosInfo",
        //POS修改接口
        FUNC_POS_UPDATEINFO: "/PosBaseController/updatePosInfo",
        //POS删除照片
        FUNC_POS_DELETEIMG: "/newMerchantProductDeploy/deleteImg",
        //详情页获取POS信息
        FUNC_POS_GETMSG:"/enterpriseController/queryPosRate",
    },
    //--------------------缓存keys---------------------
    STORAGE_FUNC: {
        //收款人信息
        PAYEE_INFO: "payeeInfo",
        //店铺信息
        STORE_INFO: "storeInfo",
        //照片信息
        PHOTO_INFO: "photoInfo",
        //pos基本信息
        POS_BAS_INFO: "posBasInfo",
        //查询商户
        QUERY_MERCHAT: "queryMerchat",
        //POS根页面
        BASIS_INFO: "basisInfo",
        //pos联系人
        // CONTACTSINFO: "contactsInfo",
        //费率码牌
        FEERATE_INFO:"feeRateInfo",
        //终端信息
        TERMINALPOSINFO: "terminalPOSInfo",
        //序列号
        SERIALNO:"serialno",
        //pos照片
        POSPHOTO: "posphoto",
        //结算信息
        // SETTLEMENTPOSINFO: "settlementPOSInfo",
        //开通扫码产品
        // OPENSCANCODE: "openScanCode",
        CHECKFOREMAIL: "checkForEmail",
        //代理商开通商户
        AGENT_OPEN_ACC: "agentOpenAcc",
        //代理商获取对账邮件
        SENDBILLEMAIL: "sendVillEmail"

    },

    //---------------------Keys-------------------
    Keys: {
        //用户信息
        USER_INFO: 'userInfo',
        //最后一个登录账号
        LAST_LOGIN_USER: 'lastLoginUser',
        //session
        SEESION: 'loginSeesion',
        //是否有二维码发送提示
        SCAN_STORE_TIP: 'scanStoreTip',
        //是否有分享提示
        NO_SHARE_TIP: 'shareTip',
        //通讯公钥
        TX_PUBKEY: 'txPubKey',
        //数据公钥
        DATA_PUBKEY: 'dataPubKey',
        //调试信息
        DEBUG : "debug",
        //商户邮箱
        STORE_EMAIL: 'stroeEmail',

        //用户相关的本地缓存
        USER_CACHE: 'userCache',
        //代理商维度本地缓存
        AGENT_CACHE: 'agentCache',
	
	//标签一列表
        ANNO_LIST_1: 'labelList1',
        //标签二列表
        ANNO_LIST_2: 'labelList2',
    },

    //---------------------网络返回码------------------
    RetCodes: {
        //成功
        SUCCESS: '0000',
        //登录超时
        SESSION_OUT: '4001',
        //不同终端登录
        KICK_OUT: '4002',

        //被代理商设置为停用
        USER_STATE_CLOSED: '00434113',
        //权限变更
        USER_STATE_NO_PERM: '00434114',

        //网络错误
        NETWORK_ERROR: '-1',
        //请求失败
        RESPONSE_ERROR: '400',
        //商户店铺为空
        EMPTY_MERCHANT: "0010",
        /**
         * desc:CA通讯证书需要更新 String:RETCODE_TXCANEEDUPDATE
         */
        RETCODE_TXCANEEDUPDATE: "00160120"
    },

    //---------------------正则校验的类型------------------
    RegexTypes: {
        //电话号
        MOBILE: "mobile",
        //代理商账号
        ASSIST_ID: "assistId",
        //用户名
        USER_ID: "userId",
        //登录密码
        LOGIN_PWD: "loginPwd",
        //账号
        ACOUNT: "loginAcount",
        //修改密码的新密码
        NEW_LOGIN_PWD: "newLoginPwd",
        //银行卡号
        BANK_ACCOUNT: "bankAccount",
        //用户名
        USER_NAME: "userName",
        //payeeName
        PAYEE_NAME: 'payeeName',
        //身份证
        ID_CARD: "identityCode",
        //短信验证码
        VERIFY_CODE: "verifyCode",
        //费率设置
        VERIFY_RATE: "verifyRate",
        //商户简称
        MERCHANT_NAME: "merchantName",
        //营业执照号
        BUSILICENSENO: "busiLicenseNo",
        //商户全称
        MERCHANTFULLNAME: "merchantFullName",
        //经营者姓名
        PROPRIETORNAME: "proprietorName",
        //主营业务
        MAINBUSINESS: "mainBusiness",
        //注册地址
        LINKMAN: "linkMan",
        REGISTEREDADDR: "registeredAddr",
        //联系人详细地址
        LINKMANADDR: "linkManAddr",
        //联系人邮箱
        LINKTELEMAIL: "linkTelEmail",
        //邮编
        ZIPCD: "zipCd",
        //固定电话
        TELPHONE: "telPhone",
        //协议编号
        CONTRID: "contrId",
        //备注信息
        REMARK: "remark",
        //组织机构代码
        REGISTRATIONNO: "registrationNo",
        //注册标识
        REGISTRATIONMARK: "registrationMark",
        //注册资金
        REGAMT: "regAmt",
        //员工数量
        EMPONUM: "empoNum",
        /*
         *  终端费率
         */
        //借记卡费率
        JFEERATE: "jfeerate",
        //借记卡封顶
        DEBITCAPAMT: "debitCapamt",
        //装机地址
        INSTALLDETAILADDR: "installDetailAddr",
        //机具金额
        GETTERMAMT: "getTermAmt",
        //
        TERMINALNUM:"terminalNums",

        /**
         * 结算信息
         */
        //支行名称
        BRANCENAME: "branceName",
        //银行户名
        BKACNAME: "bkAcName",
        //银行账户
        BKACID: "bkAcId",
        //D0费率
        RATED0: "rateD0",
        //信用卡卡号
        CARDNOCIPHER: "cardNoCipher",
        //费率
        // IMPAY_RATE: "imPayRate",

        //日期
        DATE: "date",
        //详细地址
        DETAIL_ADD: "detailAddress",


        POINT_2_CHECK: "point2Check",
        //费率校验
        RATE_CHECK: "rateCheck",
        /**
         * 开通扫码产品
         */
        ARATE: "arate",
        WRATE: "wrate",
        PHONE: "Phone",
        FIXLINE: 'fixline',/**客服电话*/
    },
    //---------------------values--------------------------
    Values: {
        //颜色
        THEME_COLOR: "#dd2c32"
    },
    //--------------------商户类别--------------------------
    BusTypes: {
        REAL_ENTERPRISE: '2',  //四期增加企业入网
        COMPANY: '1',
        PERSONAL: '0',
    },
    //--------------------产品类型--------------------------
    Products: [
        {code: "A001", tag: "impay", productName: "立马付"},
        {code: "A002", tag: "pos", productName: "POSS机"}
    ],
    //--------------------分润类型--------------------------
    //type对应了分润类型的值，与后台约定
    ProfitTypes: {
        T1: {detailTitle: 'T1分润明细', name: "T1", type: "0"},
        D0: {detailTitle: 'D0分润明细', name: "D0", type: "4"},
        D1: {detailTitle: 'D1分润明细', name: "D1", type: "5"},
        DERECT: {detailTitle: '直连分润明细', name: "DERECT", type: "1"},
        WECHAT: {detailTitle: '微信分润明细', name: "WECHAT", type: "2"},
        ALIPAY: {detailTitle: '支付宝分润明细', name: "ALIPAY", type: "3"},

        QPAY_WEPAY: {detailTitle: '立马付微信', name: "QPAY_WEPAY", type: "10"},
        QPAY_ALIPAY: {detailTitle: '立马付支付宝', name: "QPAY_ALIPAY", type: "11"},
        OFFICIAL_ACC_PAY: {detailTitle: '微信公众号支付', name: "OFFICIAL_ACC_PAY", type: "12"},
        DEBITCARD_QPAY: {detailTitle: '借记卡快捷', name: "DEBITCARD_QPAY", type: "13"},
        CREDITCARD_QPAY: {detailTitle: '信用卡快捷', name: "CREDITCARD_QPAY", type: "14"},
        PER_OBANK_PAY: {detailTitle: '个人网银', name: "PER_OBANK_PAY", type: "15"},
        ENTER_OBANK_PAY: {detailTitle: '企业网银', name: "ENTER_OBANK_PAY", type: "16"},
        WEAPP_PAY: {detailTitle: '微信APP支付', name: "WEAPP_PAY", type: "17"},
        WESCAN_PAY: {detailTitle: '微信扫码支付', name: "WESCAN_PAY", type: "18"},
        ALISCAN_PAY: {detailTitle: '支付宝扫码支付', name: "ALISCAN_PAY", type: "19"},
        IDAUTH_PAY: {detailTitle: '身份鉴权', name: "IDAUTH_PAY", type: "20"},
        BCARD_VERIFY_PAY: {detailTitle: '银行卡实名认证', name: "BCARD_VERIFY_PAY", type: "21"},
        COMPANY_PAY: {detailTitle: '企业付款', name: "COMPANY_PAY", type: "22"}
    },
    //--------------------店铺状态--------------------------
    StoreStates: {
        ImPay: [
            {code: "02", title: "待提交店铺"},
            {code: "03", title: "待上传照片"},
            {code: "04", title: "待开通产品"},
            {code: "05", title: "待邀请商户"},
            {code: "10", title: "待商户签约"},
            {code: "09", title: "待复查"},
            {code: "07", title: "待审核"},
            // SHENCHA: {code: "07", title: "自动审核通过待审查"},
            {code: "08", title: "审核通过"},//复审开通成功不需要展示
            // SUCCESS: {code: "08", title: "复审开通成功"},
            {code: "11", title: "待审核"},//待审核
            {code: "12", title: "待审核"},//待报备
            {code: "13", title: "待审核"},//待配置银商关系
            {code: "06", title: "待修改"}
        ],
//POS审核状态 TODO  “全部.index”改为代码
        showPos: [         
            { code: '-2', title: '退回' },
            { code: '-1', title: '审核中' },
            { code: '-3', title: '未提交' },
            { code: '6', title: '审核完成报备中' },
            { code: '7', title: '联动开户' },
            { code: '11', title: '联动手续费配置' },
            { code: '9', title: '联动终端分拨' },
            { code: '10', title:'完成'}
        ],
        Pos: [{ code: "0", title: "一级代理商审核" },
        { code: "1", title: "二级代理商审核" },
        { code: "3", title: "三级代理商审核" },
        { code: "4", title: "风险审核" },
        { code: "5", title: "财务审核" },
        { code: "6", title: "运营报备" },
        { code: "7", title: "运营开户" },
        { code: "8", title: "运营提现配置" },
        { code: "9", title: "运营终端分拔" },
        { code: "10", title: "完成" },
        { code: "11", title: "运营手续费配置" }

        ]
    },
    //--------------------pos状态------------------------------
    PosInfoSteps: {
        STEP_NO_INFO: {code: "0", name: "请填写"},
        STEP_NO_COMPLETE: {code: "1", name: "不完整"},
        STEP_COMPLETE: {code: "2", name: "已填完"},
        STEP_NO_SUBMIT: {code: "3", name: "请提交"},
        STEP_SUBMITED: {code: "4", name: "已提交"},
    },

    //--------------------登录来源------------------------------
    LoginFrom: {
        /**登录*/
        LOGIN: 'login',
        /**强制登录*/
        FORCE_LOGIN: 'forceLogin',
        /**自动登录*/
        AUTO_LOGIN: 'autoLogin',
        /**被踢掉*/
        KICK_OUT: 'kickOut',
        /**session超时*/
        SESSION_OUT: 'sessionOut',
        /**退出登录*/
        LOGOUT: 'logout',

        /**被代理商设置为停用*/
        USER_STATE_CLOSED: 'userClosed',
        /**权限变更*/
        USER_STATE_NO_PERM: 'userNoPerm',

        /**修改密码页面返回*/
        MODIFY_PWD: "modifyPwd"
    },

    //--------------------业务员状态----------------------------
    SalesmanStates: [
        {code: "0", btnDec: "停用业务员", alertMsg: "是否停用业务员", completeMsg: "已停用业务员", sideState: "0"},
        {code: "1", btnDec: "停用业务员", alertMsg: "是否停用业务员", completeMsg: "已停用业务员", sideState: "0"},
        {code: "4", btnDec: "启用业务员", alertMsg: "是否启用业务员", completeMsg: "已启用业务员", sideState: "1"}
    ],

    //--------------------pos交易类型----------------------------
    posTranType: [{ code: "1", name: "消费" },
     { code: "2", name: "微信支付" },
     { code: "3", name: "支付宝支付" },
     { code: "4", name: "预授权确认完成" },
    { code: "5", name: "预授权通知完成" },
    ],
    //营业执行类型
    LicenseTypes: {
        COMMON: "0",
        COLLECTION: "1"
    },

    //结算类型
    SettlementTypes:{
        PRIVATE:"0",
        PUBLIC:"1"

    }

};



